package com.assistant.markdown;

import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * Url
 *
 * @author yingjianhua
 */
@Getter
public class Url implements Content {

    private final String href;
    private final String title;

    public Url(String href, String title) {
        this.href = href;
        this.title = title;
    }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("[");
        if (StringUtils.hasLength(title)) {
            stringBuilder.append(title);
        }
        stringBuilder.append("](").append(href).append(")");
        return stringBuilder.toString();
    }
}
